package org.phantom.demo.search;

import javax.annotation.Resource;

import org.phantom.demo.integration.HttpClient;
import org.phantom.demo.integration.SocketClient;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("integration")
public class IntegrationController {

	@Resource(name="httpGateway")
	private HttpClient httpClient = null;
	
	@Resource(name="socketGateway")
	private SocketClient socketClient = null;
	@RequestMapping("http/{msg}")
	public ResponseEntity<String> http(@PathVariable("msg")String msg){
		return new ResponseEntity<String>(httpClient.sendMessage(msg),HttpStatus.OK);
	}
	@RequestMapping("socket/{msg}")
	public ResponseEntity<String> socket(@PathVariable("msg")String msg){
		return new ResponseEntity<String>(socketClient.sendName(msg),HttpStatus.OK);
	}
	@RequestMapping("ws")
	public ResponseEntity<String> webService(){
		return null;
	}
}
